From: Colin Walters Date: Wed, 13 Jul 2022 19:35:00 +0000 (-0400) Subject: sysroot: Have `ensure_writable` also always initialize X-Git-Tag: archive/raspbian/2022.5-1+rpi1^2~9^2^2~5^2 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success/%22http:/www.example.com/cgi/success?a=commitdiff_plain;h=75aa7a22f6d6499ade99f66f883dad2a3ebd413c;p=ostree.git sysroot: Have `ensure_writable` also always initialize For historical reasons we have a fair bit of distinct sysroot initialization going on. A lot of code is calling *just* the new `ensure_writable()` API, which does basically what you'd expect... except if we're not using a mount namespace. Which is the case in unit tests and legacy setups. Change this API to also ensure the sysroot is fully initialized even in those cases. Specifically we'll have `self->sysroot_fd`. For now, callers that need `/boot` also need to separately call `_ensure_boot_fd()`. --- diff --git a/src/libostree/ostree-sysroot.c b/src/libostree/ostree-sysroot.c index bcb55e55..b15265f5 100644 --- a/src/libostree/ostree-sysroot.c +++ b/src/libostree/ostree-sysroot.c @@ -328,14 +328,13 @@ gboolean _ostree_sysroot_ensure_writable (OstreeSysroot *self, GError **error) { + if (!ostree_sysroot_initialize (self, error)) + return FALSE; + /* Do nothing if no mount namespace is in use */ if (!self->mount_namespace_in_use) return TRUE; - /* If a mount namespace is in use, ensure we're initialized */ - if (!ostree_sysroot_initialize (self, error)) - return FALSE; - /* If we aren't operating on a booted system, then we don't * do anything with mounts. */